import request from '@/utils/request'

// 添加网络地址
export function addBookmark(data) {
  return request({
    url: '/bookmark/add',
    method: 'post',
    params: data
  })
}

// 修改网络地址
export function updateBookmark(data) {
  return request({
    url: '/bookmark/update',
    method: 'post',
    params: data
  })
}

// 删除网络地址
export function deleteBookmark(id) {
  return request({
    url: '/bookmark/delete',
    method: 'post',
    params: {
      id
    }
  })
}

// 获取网络地址详情
export function getBookmarkDetail(id) {
  return request({
    url: '/bookmark/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 分页查询网络地址
export function getBookmarkList(params) {
  return request({
    url: '/bookmark/page',
    method: 'get',
    params
  })
}

// 切换收藏状态
export function toggleFavorite(id) {
  return request({
    url: '/bookmark/toggleFavorite',
    method: 'post',
    params: {
      id
    }
  })
}

// 更新排序
export function updateSort(id, sort) {
  return request({
    url: '/bookmark/updateSort',
    method: 'post',
    params: {
      id,
      sort
    }
  })
} 